package status;

/**
 * 礼让
 */
public class TestYield {
    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        new Thread(myThread, "a").start();
        new Thread(myThread, "b").start();
    }
}

class MyThread implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"=>开始");
        Thread.yield();
        System.out.println(Thread.currentThread().getName()+"=>结束");
    }
}